home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / C / Blitter / PenTest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-01  |  2.4 KB  |  94 lines

  1. /* Dice: 1> dcc -l0 -mD dpk.o tags.o PenTest.c -o PenTest
  2. **
  3. ** Pen demo.
  4. */
  5.  
  6. #include <proto/dpkernel.h>
  7.  
  8. BYTE *ProgName      = "Pen Test";
  9. BYTE *ProgAuthor    = "Paul Manias";
  10. BYTE *ProgDate      = "August 1998";
  11. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998.  Freely distributable.";
  12. BYTE *ProgShort     = "Draws lots of different pen based lines.";
  13.  
  14. void main(void)
  15. {
  16.   struct GScreen *Screen;
  17.   struct JoyData *JoyData;
  18.   LONG   palette[] = { PALETTE_ARRAY, 4, 0x000000L, 0xf080f0L, 0x80f0f0, 0xf0f080 };
  19.   WORD   sx,sy,ex,ey;
  20.   LONG   mask;
  21.  
  22.   if (Screen = InitTags(NULL,
  23.       TAGS_SCREEN,    NULL,
  24.         GSA_BitmapTags, NULL,
  25.         BMA_Palette,    palette,
  26.         TAGEND,         NULL,
  27.       TAGEND)) {
  28.  
  29.      if (JoyData = Init(Get(ID_JOYDATA),NULL)) {
  30.  
  31.         Display(Screen);
  32.  
  33.         /*** Pattern 1 ***/
  34.  
  35.         SetPenShape(Screen->Bitmap,PSP_CIRCLE,2);
  36.         SetRGBPen(Screen->Bitmap,0xf080f0L);
  37.  
  38.         sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
  39.         for (ex=0; ex < Screen->Bitmap->Width; ex++) {
  40.            PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0x0f0f0f0f);
  41.         }
  42.  
  43.         SetRGBPen(Screen->Bitmap,0x80f0f0L);
  44.         for (ey=Screen->Bitmap->Height-1; ey > 0; ey--) {
  45.            PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0x0f0f0f0f);
  46.         }
  47.  
  48.         WaitTime(50);
  49.  
  50.         /*** Clear pattern 1 ***/
  51.  
  52.         SetRGBPen(Screen->Bitmap,0x000000L);
  53.         sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
  54.         for (ex=0; ex < Screen->Bitmap->Width; ex++) {
  55.            PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0xffffffff);
  56.         }
  57.         for (ey=Screen->Bitmap->Height-1; ey > 0; ey--) {
  58.            PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,0xffffffff);
  59.         }
  60.  
  61.         WaitTime(10);
  62.  
  63.         /*** Pattern 2 ***/
  64.  
  65.         SetRGBPen(Screen->Bitmap,0xf0f080L);
  66.         sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
  67.         mask = 0xAAAAAAAA;
  68.         for (ex=0; ex < Screen->Bitmap->Width; ex++) {
  69.            PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,mask);
  70.            mask = ~mask;
  71.            sx++;
  72.         }
  73.  
  74.         WaitTime(50);
  75.  
  76.         /*** Clear pattern 2 ***/
  77.  
  78.         mask = 0xffffffff;
  79.         SetRGBPen(Screen->Bitmap,0x000000L);
  80.         sx=0; sy=Screen->Bitmap->Height-1; ex=Screen->Bitmap->Width-1; ey=Screen->Bitmap->Height-1;
  81.         for (sy=Screen->Bitmap->Height-1; sy >= 0; sy--) {
  82.            PenLinePxl(Screen->Bitmap,sx,sy,ex,ey,mask);
  83.            ey--;
  84.         }
  85.  
  86.         WaitTime(50);
  87.  
  88.      Free(JoyData);
  89.      }
  90.   Free(Screen);
  91.   }
  92. }
  93.  
  94.